package com.newasia.shopping.dal.entitys;

import com.alibaba.fastjson.JSON;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

public class ItemSku implements Serializable {
    private Long skuId;

    private Long spuId;

    private BigDecimal skuPrice;

    private Integer num;

    private Integer limitNum;

    private Integer status;

    private Date createTime;

    private Date updateTime;

    private String skuSpecListId;

    private String skuSpecListName;

    private List<String> imageList;

    private List<String> specIds;

    private List<String> specNames;

    private String skuImage;

    private static final long serialVersionUID = 1L;

    public Long getSkuId() {
        return skuId;
    }

    public void setSkuId(Long skuId) {
        this.skuId = skuId;
    }

    public Long getSpuId() {
        return spuId;
    }

    public void setSpuId(Long spuId) {
        this.spuId = spuId;
    }

    public BigDecimal getSkuPrice() {
        return skuPrice;
    }

    public void setSkuPrice(BigDecimal skuPrice) {
        this.skuPrice = skuPrice;
    }

    public Integer getNum() {
        return num;
    }

    public void setNum(Integer num) {
        this.num = num;
    }

    public Integer getLimitNum() {
        return limitNum;
    }

    public void setLimitNum(Integer limitNum) {
        this.limitNum = limitNum;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public String getSkuSpecListId() {
        return skuSpecListId;
    }

    public void setSkuSpecListId(String skuSpecListId) {
        this.skuSpecListId = skuSpecListId == null ? null : skuSpecListId.trim();
    }

    public String getSkuSpecListName() {
        return skuSpecListName;
    }

    public void setSkuSpecListName(String skuSpecListName) {
        this.skuSpecListName = skuSpecListName == null ? null : skuSpecListName.trim();
    }

    public String getSkuImage() {
        return skuImage;
    }

    public void setSkuImage(String skuImage) {
        this.skuImage = skuImage;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", skuId=").append(skuId);
        sb.append(", spuId=").append(spuId);
        sb.append(", skuPrice=").append(skuPrice);
        sb.append(", num=").append(num);
        sb.append(", limitNum=").append(limitNum);
        sb.append(", status=").append(status);
        sb.append(", createTime=").append(createTime);
        sb.append(", updateTime=").append(updateTime);
        sb.append(", skuSpecListId=").append(skuSpecListId);
        sb.append(", skuSpecListName=").append(skuSpecListName);
        sb.append(", skuImage=").append(skuImage);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }

    public void setImageList(List<String> imageList) {
        this.skuImage = JSON.toJSONString(imageList);
    }

    public List<String> getImageList(){
        if (this.skuImage != null && !"".equals(this.skuImage)) {
            List<String> images = JSON.parseArray(this.skuImage,String.class);
            return images;
        }
        return null;
    }

    public List<Long> getSpecIds() {
        return JSON.parseArray(this.skuSpecListId,Long.class);
    }

    public void setSpecIds(List<Long> specIds) {
        this.skuSpecListId = JSON.toJSONString(specIds);
    }

    public List<String> getSpecNames() {
        return JSON.parseArray(this.skuSpecListName,String.class);
    }

    public void setSpecNames(List<String> specNames) {
        this.skuSpecListName = JSON.toJSONString(specNames);
    }

    public String getImageBig(){
        return JSON.parseArray(this.skuImage,String.class).get(0);
    }
}